package com.example.footballsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.footballsystem.entity.Field;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FieldMapper extends BaseMapper<Field> {
    @Select("select * from field")
    public List<Field> getAllField();
    @Select("select * from field where FieldID=#{id}")
    public List<Field> getFieldByID(int id);
    @Select("select * from field where Address=#{address}")
    public List<Field> getFieldByAdress(String adddress);
    @Select("select * from field where MasterAccount=#{masterAccount}")
    public  List<Field> getFieldByMasterAccount(String masterAccount);
    @Select("select latitude from field where FieldID=#{id}")
    public float getLatitude(int id);
    @Select("select longitude from field where FieldID=#{id}")
    public float getLongitude(int id);
    @Insert("insert into field values (#{fieldID},#{address},#{openTime},#{closeTime},#{masterAccount},#{price},#{createDate},#{latitude},#{longitude},#{notes})")
    public Boolean addField(Field field);
    @Delete("delete from field where FieldID=#{fieldID}")
    public Boolean deleteField(int fieldID);

}